.class public Lrexsee/core/menu/PopMenu;
.super Ljava/lang/Object;
.source "PopMenu.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lrexsee/core/menu/PopMenu$DynamicLocation;
    }
.end annotation


# instance fields
.field public cancelRunnable:Ljava/lang/Runnable;

.field public dismissRunnable:Ljava/lang/Runnable;

.field public dynamicLocation:Lrexsee/core/menu/PopMenu$DynamicLocation;

.field public final id:Ljava/lang/String;

.field public final items:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lrexsee/core/menu/PopMenuItem;",
            ">;"
        }
    .end annotation
.end field

.field private final mBrowser:Lrexsee/core/browser/Browser;

.field public final styleSheet:Lrexsee/core/style/StyleSheet;


# direct methods
.method public constructor <init>(Lrexsee/core/browser/Browser;Ljava/lang/String;Ljava/lang/String;)V
    .locals 2
    .param p1, "browser"    # Lrexsee/core/browser/Browser;
    .param p2, "menuId"    # Ljava/lang/String;
    .param p3, "style"    # Ljava/lang/String;

    .prologue
    const/4 v0, 0x0

    .line 38
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 32
    iput-object v0, p0, Lrexsee/core/menu/PopMenu;->cancelRunnable:Ljava/lang/Runnable;

    .line 33
    iput-object v0, p0, Lrexsee/core/menu/PopMenu;->dismissRunnable:Ljava/lang/Runnable;

    .line 34
    iput-object v0, p0, Lrexsee/core/menu/PopMenu;->dynamicLocation:Lrexsee/core/menu/PopMenu$DynamicLocation;

    .line 39
    iput-object p2, p0, Lrexsee/core/menu/PopMenu;->id:Ljava/lang/String;

    .line 40
    iput-object p1, p0, Lrexsee/core/menu/PopMenu;->mBrowser:Lrexsee/core/browser/Browser;

    .line 41
    new-instance v0, Lrexsee/core/style/StyleSheet;

    invoke-virtual {p1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Lrexsee/core/style/StyleSheet;-><init>(Landroid/content/Context;)V

    invoke-virtual {v0, p3}, Lrexsee/core/style/StyleSheet;->parseStyle(Ljava/lang/String;)Lrexsee/core/style/StyleSheet;

    move-result-object v0

    iput-object v0, p0, Lrexsee/core/menu/PopMenu;->styleSheet:Lrexsee/core/style/StyleSheet;

    .line 42
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lrexsee/core/menu/PopMenu;->items:Ljava/util/ArrayList;

    .line 43
    return-void
.end method

.method static synthetic access$0(Lrexsee/core/menu/PopMenu;)Lrexsee/core/browser/Browser;
    .locals 1

    .prologue
    .line 36
    iget-object v0, p0, Lrexsee/core/menu/PopMenu;->mBrowser:Lrexsee/core/browser/Browser;

    return-object v0
.end method


# virtual methods
.method public add(Lrexsee/core/menu/PopMenuItem;)V
    .locals 1
    .param p1, "item"    # Lrexsee/core/menu/PopMenuItem;

    .prologue
    .line 46
    if-nez p1, :cond_0

    .line 48
    :goto_0
    return-void

    .line 47
    :cond_0
    iget-object v0, p0, Lrexsee/core/menu/PopMenu;->items:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_0
.end method

.method public composeOptionsMenu(Landroid/view/Menu;)V
    .locals 5
    .param p1, "menu"    # Landroid/view/Menu;

    .prologue
    const/4 v4, 0x0

    .line 189
    invoke-interface {p1}, Landroid/view/Menu;->clear()V

    .line 190
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_0
    iget-object v2, p0, Lrexsee/core/menu/PopMenu;->items:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v2

    if-lt v0, v2, :cond_0

    .line 194
    return-void

    .line 191
    :cond_0
    iget-object v2, p0, Lrexsee/core/menu/PopMenu;->items:Ljava/util/ArrayList;

    invoke-virtual {v2, v0}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lrexsee/core/menu/PopMenuItem;

    .line 192
    .local v1, "item":Lrexsee/core/menu/PopMenuItem;
    iget-object v2, v1, Lrexsee/core/menu/PopMenuItem;->styleNormal:Lrexsee/core/style/StyleSheet;

    iget-object v2, v2, Lrexsee/core/style/StyleSheet;->label:Ljava/lang/String;

    invoke-interface {p1, v4, v0, v4, v2}, Landroid/view/Menu;->add(IIILjava/lang/CharSequence;)Landroid/view/MenuItem;

    move-result-object v2

    iget-object v3, v1, Lrexsee/core/menu/PopMenuItem;->styleNormal:Lrexsee/core/style/StyleSheet;

    iget-object v3, v3, Lrexsee/core/style/StyleSheet;->icon:Landroid/graphics/drawable/Drawable;

    invoke-interface {v2, v3}, Landroid/view/MenuItem;->setIcon(Landroid/graphics/drawable/Drawable;)Landroid/view/MenuItem;

    .line 190
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method

.method public get(Ljava/lang/String;)Lrexsee/core/menu/PopMenuItem;
    .locals 3
    .param p1, "id"    # Ljava/lang/String;

    .prologue
    .line 50
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_0
    iget-object v2, p0, Lrexsee/core/menu/PopMenu;->items:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v2

    if-lt v0, v2, :cond_0

    .line 54
    const/4 v2, 0x0

    :goto_1
    return-object v2

    .line 51
    :cond_0
    iget-object v2, p0, Lrexsee/core/menu/PopMenu;->items:Ljava/util/ArrayList;

    invoke-virtual {v2, v0}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lrexsee/core/menu/PopMenuItem;

    .line 52
    .local v1, "item":Lrexsee/core/menu/PopMenuItem;
    iget-object v2, v1, Lrexsee/core/menu/PopMenuItem;->id:Ljava/lang/String;

    invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_1

    move-object v2, v1

    goto :goto_1

    .line 50
    :cond_1
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method

.method public open(Lrexsee/core/browser/Browser;)V
    .locals 5
    .param p1, "browser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 67
    invoke-virtual {p1}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v1

    .line 68
    .local v1, "context":Landroid/content/Context;
    move-object v2, p0

    .line 69
    .local v2, "mThis":Lrexsee/core/menu/PopMenu;
    move-object v0, v1

    check-cast v0, Landroid/app/Activity;

    move-object v3, v0

    new-instance v4, Lrexsee/core/menu/PopMenu$1;

    invoke-direct {v4, p0, v1, p1, v2}, Lrexsee/core/menu/PopMenu$1;-><init>(Lrexsee/core/menu/PopMenu;Landroid/content/Context;Lrexsee/core/browser/Browser;Lrexsee/core/menu/PopMenu;)V

    invoke-virtual {v3, v4}, Landroid/app/Activity;->runOnUiThread(Ljava/lang/Runnable;)V

    .line 186
    return-void
.end method

.method public remove(Ljava/lang/String;)V
    .locals 3
    .param p1, "id"    # Ljava/lang/String;

    .prologue
    .line 57
    const/4 v0, 0x0

    .local v0, "i":I
    :goto_0
    iget-object v2, p0, Lrexsee/core/menu/PopMenu;->items:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v2

    if-lt v0, v2, :cond_0

    .line 61
    return-void

    .line 58
    :cond_0
    iget-object v2, p0, Lrexsee/core/menu/PopMenu;->items:Ljava/util/ArrayList;

    invoke-virtual {v2, v0}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lrexsee/core/menu/PopMenuItem;

    .line 59
    .local v1, "item":Lrexsee/core/menu/PopMenuItem;
    iget-object v2, v1, Lrexsee/core/menu/PopMenuItem;->id:Ljava/lang/String;

    invoke-virtual {p1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_1

    iget-object v2, p0, Lrexsee/core/menu/PopMenu;->items:Ljava/util/ArrayList;

    invoke-virtual {v2, v0}, Ljava/util/ArrayList;->remove(I)Ljava/lang/Object;

    .line 57
    :cond_1
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method

.method public run(Lrexsee/core/browser/Browser;Ljava/lang/String;)V
    .locals 2
    .param p1, "browser"    # Lrexsee/core/browser/Browser;
    .param p2, "id"    # Ljava/lang/String;

    .prologue
    .line 63
    invoke-virtual {p0, p2}, Lrexsee/core/menu/PopMenu;->get(Ljava/lang/String;)Lrexsee/core/menu/PopMenuItem;

    move-result-object v0

    .line 64
    .local v0, "item":Lrexsee/core/menu/PopMenuItem;
    if-eqz v0, :cond_0

    iget-object v1, v0, Lrexsee/core/menu/PopMenuItem;->upRunnable:Ljava/lang/Runnable;

    if-eqz v1, :cond_0

    iget-object v1, v0, Lrexsee/core/menu/PopMenuItem;->upRunnable:Ljava/lang/Runnable;

    invoke-interface {v1}, Ljava/lang/Runnable;->run()V

    .line 65
    :cond_0
    return-void
.end method
